package xkp.lesson4;

class A {
    public void func() {
        System.out.println("func in A");
    }
}
class B extends A {
    public void func() {
        System.out.println("func in B");
    }
}
class C extends B {
    public void func() {
        System.out.println("func in C");
    }
}
public class Bar {
    public void test(A a) {
        a.func();
    }

	/*
	 * public void test(B b) { b.func(); } public void test(C c) { c.func(); }
	 */
    public static void main(String[] args) {
        Bar bar = new Bar();
        A a = new A();
        B b = new B();
        C c = new C();
        bar.test(a);
        bar.test(b);
        bar.test(c);
        /*
            func in A
            func in B  
            func in C     
         */
    }
}